<?php

namespace module\app\controller;

use app\Controller;
use app\model\Help as Model;
use think\facade\View;

class Help extends Controller
{
    /**
     * 详情.
     * 
     */
    public function read(int $id)
    {
        $model = Model::where('id', $id)->findOrEmpty();
        return View::fetch('/help', [
            'title' => $model->title ?? '', 
            'content' => $model->content ?? ''
        ]);
    }
    /**
     * 详情.
     * 
     */
    public function info(string $type = 'rule')
    {
        $model = Model::where('type', $type)->field(['title', 'content'])->findOrEmpty();
        return View::fetch('/help', [
            'title' => $model->title ?: '', 
            'content' => $model->content ?: ''
        ]);
    }
}
